function init()
		{
			var bodyHeight = getBrowserHeight();
			var bodyWidth  = getBrowserWidth();
			
			
			var loginPanelHeight = $("#loginPanel").outerHeight(true);
			var loginPanelWidth = $("#loginPanel").outerWidth(true);
			
			var top = (bodyHeight - loginPanelHeight)/2;
			var left = (bodyWidth - loginPanelWidth)/2;
			
			
			$("#box").css("top",top+"px").css("left",left+"px");
		}
	
		$(function(){
			
			
			if(window.parent.length>0){
					window.top.location.href = window.location.href;
			}
			
			init();
			
			$(".formLoad").ajaxSend(function(){
				$(this).show();
				$(".formButton").hide();
			});
			
			$(".formLoad").ajaxComplete(function(){
				$(this).hide();
				$(".formButton").show();
			});
			
			
			$("#username").focus();
			
			if($.cookie('username'))
			{
				$("#username").val($.cookie('username'));
				$("#password").focus();
			}
			
			$("#loginPanel").keydown(function(event){
				if(event.keyCode === 13)
				{
					$("#loginButton").click();
				}
			});
			
			$("#loginButton").click(function(){
				if($.trim($("#username").val()).length === 0 )
				{
					alert("用户名不能为空");
					$("#username").focus();
					return false;
				}
				
				
				if($.trim($("#password").val()).length === 0 )
				{
					alert("密码不能为空");
					$("#password").focus();
					return false;
				}
				
				$.post(
					"operator.do?type=login",
					{
						username:$("#username").val(),
						password:$("#password").val()
					},
					function(xml){
						 var flag   = parseInt($(xml).find("flag").text());
						 var body = $(xml).find("body").text();
						 
						 
						 if(flag != 1)
						 {
						 	alert(body);
						 	$("#username").focus();
						 	return false;
						 }
						 else if(flag === 1)
						 {
						 		//var h = window.screen.availHeight;
						 		//var w = window.screen.availWidth;
						 		var h =window.screen.height;
						 		var w = window.screen.width;
						 		
						 		//var h =768;
						 		//var w=1024;
						 		
						 		
						 		
						 		window.location.href = "main.jsp";
						 		//window.showModalDialog("main.jsp","武汉城市管理局垃圾处理费营业管理系统","scroll:0;status:0;help:1;resizable:0;dialogWidth:"+ w +"px;dialogHeight:"+h+"px" );
						 		//window.close();
						 		//window.open("main.jsp","武汉城市管理局垃圾处理费营业管理系统");
						 		
						 		//记住用户名功能
						 		
						 		$.cookie('username', $.trim($("#username").val()), { expires: 9999});
						 	
						 }
						 
						 
					},
					'xml');
				
			});
			
		})